package day06

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object a {
  def main(args: Array[String]): Unit = {

    val conf: SparkConf = new SparkConf().setAppName("a").setMaster("local")
    val sc = new SparkContext(conf)

    val data: Array[Int] = sc.parallelize(Array(1, 2, 3, 4, 5, 6, 7)).collect()
    var sum=0
    data.map(x => sum+=x)  //可行
    data.foreach(x => sum+= x) //可行
    println(sum)


  }
}
